#!/bin/sh
function compile_file(){
	Name="$(echo "$1" | sed "s/\(.*\)\.c/\1/")"
	gcc -Wall -Werror -lX11 -lm -lpthread "${Name}.c" -o "$Name"
}

if [ "$1" != "" ]; then
	compile_file "$1"
else
	for file in *.c; do
		compile_file "$file"
	done
fi
rm -f *.o
